package com.itheima.wemedia.feign;

import com.itheima.common.vo.ResultVo;
import com.itheima.wemedia.dto.WmNewsPageReqDto;
import com.itheima.wemedia.pojo.WmNews;
import com.itheima.wemedia.pojo.WmUser;
import com.itheima.wemedia.vo.WmNewsVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(name = "leadnews-wemedia", contextId = "WmNewsFeign")
public interface WmNewsFeign {

    /**
     * 通过远程调用weNewsId查询文章信息
     *
     * @param newsId
     * @return
     */
    @GetMapping("/api/wmNews/getByWmNewsId/{newsId}")
    ResultVo<WmNews> getByWmNewsId(@PathVariable("newsId") long newsId);

    /**
     * 通过远程调用更新文章信息
     *
     * @param wmNews
     * @return
     */
    @PutMapping("/api/wmNews/update")
    ResultVo update(@RequestBody WmNews wmNews);


    /**
     * 远程调用自媒体微服务查询文章信息  ————文章同步
     * @param dto  ：为了做分片处理
     * @return
     */
    @PostMapping("/api/wmNews/syncArticleTask")
    ResultVo<List<WmNewsVo>>  syncArticleTask(@RequestBody WmNewsPageReqDto dto);

}
